﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace intheweel
{
    class Dbhelper
    {
        private static readonly string connmit = "server = .; database = Blogs ; uid = sa ; pwd = chen5201314";

        public static DataTable GetData(string sql)
        {
            SqlConnection youyou = new SqlConnection(connmit);
            SqlDataAdapter Datadapter = new SqlDataAdapter(sql, youyou);

            DataTable dt = new DataTable();

            youyou.Open();
            Datadapter.Fill(dt);

            return dt;
        }
        public static int  Luoxuan (string sql)
        {
            SqlConnection zuozuo = new SqlConnection(connmit);

            SqlCommand command = new SqlCommand(sql, zuozuo);

            zuozuo.Open();

            return command.ExecuteNonQuery();
        }





    }
}
